namespace hjc {

	export abstract class SingComp extends Singleton implements IComponent {

		protected $delta: number = 1;		//每隔delta帧进行一次计算
		protected $rest: number = 1;		//剩余reset帧进行一次计算
		protected $entity: Entity = null;	//挂载实体
		protected $enabled: boolean = true;	//是否有效
		public get delta(): number { return this.$delta; }
		public set delta(delta: number) { this.$delta = delta; }
		public get entity(): Entity { return this.$entity; }
		public set entity(entity: Entity) { this.$entity = entity; }
		public get enabled(): boolean { return this.$enabled; }
		public set enabled(enabled: boolean) { this.$enabled = enabled; }
		public checkPfc(): boolean {
			this.$rest--;
			if (this.$rest > 0) return false;
			else this.resetPfc();
			return this.enabled;
		}
		public immediatePfc(): void { this.$rest = 0; }
		protected resetPfc(): void { this.$rest = this.$delta; }
	}
}